<div class="attendease-venues">
  <div class="attendease-header">
    {% assign t_size = page.venues.size %}
    <h1>{% attendease_t event.lingo.venues %}</h2>
  </div>

  {% for venue in page.venues %}

    <div class="attendease-venue" data-venue-id="{{ venue.id }}">

      {% if venue.address.latitude && venue.address.longitude %}
        {% if venue.primary %}
          {% assign marker_colour = 'blue' %}
        {% else %}
          {% assign marker_colour = 'red' %}
        {% endif %}

        <div class="attendease-venue-map">
          <div class="attendease-venue-map-image">
            <a href="/venues/{{ venue.slug }}"><img src="https://maps.google.com/maps/api/staticmap?center={{ venue.address.latitude }},{{ venue.address.longitude }}&zoom=13&size=100x100&sensor=false&markers=color:{{ marker_colour }}%7C{{ venue.address.latitude }},{{ venue.address.longitude }}" width="100" height="100" /></a>
          </div>
        </div>
      {% endif %}

      <div class="attendease-venue-name">
        <a href="/venues/{{ venue.slug }}">{{ venue.name }}</a>
      </div>

      <div class="attendease-venue-address">
        {% if venue.address.address1 and venue.address.address1 != "" %}
          <div class="attendease-venue-address-address1">
            {{ venue.address.address1 }}
          </div>
        {% endif %}

        {% if venue.address.address2 and venue.address.address2 != "" %}
          <div class="attendease-venue-address-address2">
            {{ venue.address.address2 }}
          </div>
        {% endif %}

        <div class="attendease-venue-address-location">
          {% assign has_state = false %}
          {% assign has_city = false %}
          {% assign has_country = false %}

          {% if venue.address.state and venue.address.state != "" %}
            {% assign has_state = true %}
          {% endif %}

          {% if venue.address.city and venue.address.city != "" %}
            {% assign has_city = true %}
          {% endif %}

          {% if venue.address.country and venue.address.country != "" %}
            {% assign has_country = true %}
          {% endif %}

          {% if has_city %}
            {{ venue.address.city }}{% if has_state or has_country %},{% endif %}
          {% endif %}

          {% if has_state %}
            {{ venue.address.state }}{% if has_country %},{% endif %}
          {% endif %}

          {% if has_country %}
            {{ venue.address.country }}
          {% endif %}
        </div>

        {% if venue.address.zip and venue.address.zip != "" %}
          <div class="attendease-venue-address-zip">
            {{ venue.address.zip }}
          </div>
        {% endif %}
      </div>

    </div>
  {% endfor %}
</div>
